import request from '@/utils/request'

const headers = {
  'Content-Type': 'application/json'
}

export function getDepts() {
  return request({
    url: 'api/dept/list',
    method: 'post'
  })
}

export function getSysUserByDeptId(data) {
  return request({
    url: 'api/dept/userList',
    method: 'post',
    data: JSON.stringify(data),
    headers
  })
}

export function add(data) {
  return request({
    url: 'api/dept/add',
    method: 'post',
    data: JSON.stringify(data),
    headers
  })
}

export function del(data) {
  return request({
    url: 'api/dept/delete',
    method: 'post',
    data: JSON.stringify(data),
    headers
  })
}

export function edit(data) {
  return request({
    url: 'api/dept/edit',
    method: 'post',
    data: JSON.stringify(data),
    headers
  })
}

export default { getDepts, add, edit, del }
